import { Swagger, Options } from '../interface';

export function serviceLoader(options: Partial<Options> = {}, content: Partial<Swagger>) {
  const result = {};

  Object.keys(content).forEach(key => {
    const fileName = key.split('/')[0];

    if (!result[fileName]) {
      result[fileName] = [];
    }

    result[fileName].push(content[key]);
  });

  return result;
};
